home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / pascal / swag / printing.swg / 0035_Is Printer Online ??.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-08-24  |  640 b   |  25 lines

  1. {
  2. >>    I'm using TP6 and plan to use to the PRINTER.TPU unit the
  3. >>    write to the printer.  How do you detect whether the printer
  4. >>    is on or not without ending up a dos error and the program
  5. >>    halting.
  6.  
  7.    You need to check the status of the printer port.  Something like
  8. this:
  9. }
  10.  
  11. function TESTONLINE : Byte;           { Tests for Printer On Line }
  12. var REGS : Registers;
  13. begin
  14.   with REGS do
  15.     begin
  16.       AH := 2; DX := 0;
  17.       Intr($17, Dos.Registers(REGS));
  18.       TESTONLINE := AH
  19.     end
  20. end;  { TESTONLINE }
  21.  
  22.   if TESTONLINE = 144 then okay_to_print
  23.   else                     printer_not_ready
  24.  
  25.